<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <p>请选择你最喜欢的游戏（多选）</p>
    <label for=""><input type ='checkbox' name = 'game' value = '王者'>王者荣耀</label>
    <label for=""><input type ='checkbox' name = 'game' value = '和平'>和平精英</label>
    <label for=""><input type ='checkbox' name = 'game' value = '炫斗'>QQ炫斗</label>
    <script>
        //getElementsByName()获取元素
        var games = document.getElementsByName('game');
        games[0].checked = true;
    </script>
</body>
</html>